//获取一个打乱数组顺序
//Get the scramble array
//arr 想要数组
//arrayLength 数组长度
function shuffle(arr, arrayLength) {
    if (arrayLength <= 0) {
        return null;
    }

    let len = arr.length - 1;
    
    if (arrayLength === 1) {
        return arr[Math.round(Math.random() * len)];
    }
    let temp = [];

    for (let i = 0; i < arrayLength; i++) {
        let index = Math.round(Math.random() * len);
        console.log(index);
        temp[i] = arr[index];
    }
    return temp;
}

export default shuffle;